package com.markus.code.exam.baidu;

import java.util.Scanner;

/**
 * Author:markusZhang
 * Date:Create in 2020/9/3 20:03
 * todo:
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()) {
            int n = scanner.nextInt();
            int m = scanner.nextInt();
            Main1 demo = new Main1();
            System.out.println(demo.process(n,0,0,0,m));
        }
    }
    int ans = 0;
    private int process(int num,int pre,int prePre,int sum,int x){
        if (sum == num){
            return 1;
        }
        if (sum > num){
            return 0;
        }
        for (int i=1;i<=x;i++){
            if (i == pre || i == prePre){
                continue;
            }
            ans += process(num,pre,prePre,sum+i,x);
        }
        return ans;
    }
}
